public class ThreadDemo1 {
    public static boolean isQuit = false;
    public static void main(String[] args) {
        Thread t = new Thread(() -> {
            while(!isQuit){
                System.out.println(Thread.currentThread().getName() + "给某客户转账中");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
            System.out.println(Thread.currentThread().getName() + "立马停止转账，并长吁一口气，\"好险好险\"");
        },"王五");
        t.start();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(Thread.currentThread().getName()+" 说 \"坏了，遇到骗子了，叫王五停止转转！\"");
        isQuit = true;
    }
}
